<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>92Play后台管理</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/managercss.css" />
<style type="text/css">
<!--
body {
	margin-left: 5px;
	margin-top: 5px;
	margin-right: 5px;
	background:#EFEFEF;
}
-->
</style>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.form.js"></script>
<script type="text/javascript">
	var ctp = '<%=request.getContextPath() %>';
	$(function(){
		$("#updatePwd").click(function(){
			var oldPwd = $("#oldPwd").val();
			var newPwd = $("#newPwd").val();
			$(this).attr("disabled","true");
			if(oldPwd==''||newPwd==''){
				alert("请输入完整信息!");
				$(this).removeAttr("disabled");
				return;
			}else{
				var date = $("#userForm").formSerialize();
				$.ajax({
					url:ctp+"/admin/adminUser/updatePwd",
					data:date,
					type:"POST",
					success:function(flag){
						if(flag==0){
							alert("修改成功，请重新登录!");
							top.location.href=ctp+"/index.jsp";
						}else if(flag==2){
							alert("当前密码错误,修改失败!");
							$("#oldPwd").focus();
							$("#updatePwd").removeAttr("disabled");
						}else{
							alert("系统异常，修改失败");
							$("#updatePwd").removeAttr("disabled");
						}
					}
				});
				return;
			}
		});
	});
</script>
</head>
<body>
<div class="information">
	<div class="title">
		修改密码
	</div>
	<div class="list">
		<form method="post" id="userForm">
		<div class="noselect">
			<ul>
				<li style="width: 100px;text-align: right;">用户名称：</li>
				<li style="width: 300px;text-align: left;">
					<input type="text" value="${sessionScope.adminUser.userName }" size="20" disabled="disabled"></input>
				</li>
			</ul>
			<div class="clear"></div>
			<ul>
				<li style="width: 100px;text-align: right;">当前密码：</li>
				<li style="width: 300px;text-align: left;">
					<input type="password" name="oldPwd" id="oldPwd" size="20">
				</li>
			</ul>
			<div class="clear"></div>
			<ul>
				<li style="width: 100px;text-align: right;">新密码：</li>
				<li style="width: 300px;text-align: left;">
					<input type="password" name="newPwd" id="newPwd" size="20">
				</li>
			</ul>
			<div class="clear"></div>
			<ul>
				<li style="width: 100px;text-align: right;">&nbsp;</li>
				<li style="width: 300px;text-align: left;">
					<input type="button" id="updatePwd" value="修改" /> 
				</li>
			</ul>
			<div class="clear"></div>
		</div>
		</form>
	</div>
</div>
</body>
</html>